Repository navigation
Bring the image upload (PR #2) into master - #4
Merged
Merged
Conversation
uploadImage(path, params) and uploadImageBytes(bytes, file_name, params), plus the typed uploadImageAs / uploadImageBytesAs, POST the image to https://serpapi.com/image as multipart/form-data and return its image_id for engines such as Google Lens. Ported from serpapi-rust's image-api. - the image goes in field `image`, filename kept (quotes and CR/LF escaped), content type sniffed from the JPEG/PNG/WebP signature, then the extension - api_key and source travel in the body, never in the URL; constructor search defaults (engine, output, ...) are not sent; a call param named `image` is a compile error - images over 500 KiB are rejected with error.ImageTooLarge before being read or sent - the upload shares fetch with every GET: the timeout race, the status check, the error payload rule, and lastError(), whose url is https://serpapi.com/image for a failed upload - live tests: upload from a file and from bytes, invalid image, invalid key, then a google_lens search on the uploaded image; oobt also uploads Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add uploadImage for the Image API (F7)
AI: Claude Opus 5.5 · effort unknown · main session: fixed reviewer finding 1 (stale lastError after a file error in uploadImage), with a unit test that fails without the fix A file error in uploadImage (missing file, unreadable path) returns before fetch, which is where every other request clears the previous failure, so lastError() kept describing an earlier, unrelated request. That contradicts the 1.2.0 behavior change: errorMessage() and lastError() describe the most recent request only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR #2 (
image-api) was merged intoparity-fixes, notmaster. It landed 29 seconds after PR #1 had already mergedparity-fixesintomaster, souploadImagenever reachedmaster.This merges
origin/parity-fixes(b617d9e + merge e0ad0a9) into the currentmaster. There were no conflicts: CHANGELOG.md and README.md auto-merged cleanly.Brings in:
uploadImage/uploadImageBytes(+ typed*Asvariants) for the Image APIerror.ImageTooLargeinserpapi.ErrorlastErrorat the start of an image upload (cherry-picked 30231d8): a file error returned before fetch leftlastError()describing an earlier requestTests:
zig build test: 42/42 pass.🤖 Generated with Claude Code